<div class="bjui-pageContent">
    <div class="bjui-pageHeader" style="background-color:#fefefe; border-bottom:none;">
        <form data-toggle="ajaxsearch" data-options="{searchDatagrid:$.CurrentNavtab.find('#sn-code-lists')}">
            <fieldset>
                <legend style="font-weight:normal;">搜索：</legend>
                <div style="margin:0; padding:1px 5px 5px;">

                    <span>码：</span>
                    <input type="text" name="sn" class="form-control" size="30">

                    <span>类型：</span>
                    <select name="type" data-toggle="selectpicker">
                        <option value="0">全部</option>
                        <option value="1">已绑定</option>
                        <option value="2">未绑定</option>
                    </select>

                    <div class="btn-group">
                        <button type="submit" class="btn-green" data-icon="search">开始搜索</button>
                        <button type="reset" class="btn-orange" data-icon="times">重置</button>
                    </div>
                </div>
            </fieldset>
        </form>
    </div>
    <p>
        <button type="button" class="btn-default" data-toggle="navtab"
            data-options="{
                    id:'pro-sn-ad-navtab',
                    fresh:true,
                    url:'admin/pro/sn-add',
                    title:'添加码'
                }"
        >
            生成码
        </button>
    </p>
    <table class="table table-bordered" id="sn-code-lists" data-toggle="datagrid" data-options="{
        tableWidth: '100%',
        height: '100%',
        gridTitle : '码',
        showToolbar: false,
        toolbarItem: 'add',
        local: 'local',
        dataUrl: '/admin/pro/sn-code-lists',
        linenumberAll: false,
        showLinenumber: false,
        showCheckboxcol: false,
        {{--showEditbtnscol: '操作',--}}
        filterThead: false,
        {{--editUrl: '/admin/pro/edit',--}}
        {{--editCallback:editCallback,--}}
        {{--delUrl:'/admin/pro/delete',--}}
        {{--delPK:'id',--}}
        {{--delConfirm: true,--}}

        {{--exportOption:{type:'file', options:{url:'admin/export/process-field',type:'post',data: {_token : '{{ csrf_token() }}'}}}--}}
    }">
        <thead>
        <tr>
            <th data-options="{name:'id',width:50,align:'center',add:false,edit:false}">编号</th>
            <th data-options="{name:'sn',add:false,edit:false,align:'center'}">sn</th>
            <th data-options="{name:'total_number',align:'center'}">总数量</th>
            <th data-options="{name:'now_number',add:false,edit:false,align:'center'}">当前数量</th>
            <th data-options="{name:'product_name',add:false,edit:false,align:'center'}">绑定的材料</th>
            {{--<th data-options="{align:'center',width:200,render:selectCategory}">选择材料</th>--}}
        </tr>
        </thead>
    </table>
</div>>
<script type="text/javascript">
    function selectCategory(value, data){
        var category_html  = '<button '+'id=choose_product_btn_'+data.id+' type="button" class="btn btn-info" data-toggle="dialog" data-options="';
        category_html  += '{id:\'product-list-for-select-dialog\',title:\''+'选择材料\',';
        category_html  += 'fresh:true,';
        category_html  += 'height:400,width:400,';
        category_html  += 'url:\'/admin/pro/product-list-for-select\',data:{id:'+data.id+','+'product_id:' + data.product_id + '}}';
        if(data.product_name != null){
            category_html  += '">'+data.product_name+'</button>';
        }
        else{
            category_html  += '">选择材料</button>';
        }


        return category_html;
    }
    function afterSave(m,n)
    {
        var html = m.find('.delete').hide();
    }
</script>